package slash.entities;

import java.util.*;

import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Shape;

import slash.MainGame;
import slash.collision.Collidable;
import slash.collision.CollisionMask;
import slash.util.IRenderable;

public class AbstractEntity implements IRenderable{
	
	/** Collision Mask that makes entity collidable */
	private CollisionMask mask;
	/** X and Y position on the map */
	private float posX, posY;
	/** Entity movement speed variable */
	private float speed = 0.1f;
	/** Width and Height of entity image */
	private float width, height;
	/** Boolean if entity can collide */
	private boolean collidable;
	/** Boolean if entity moves or is stationary */
	private boolean stationary;
	
	public AbstractEntity(float x, float y){
		this.setPosX(x);
		this.setPosY(y);
	}
	
	public AbstractEntity(float x, float y, Shape shape){
		this(x,y);
		mask = new CollisionMask(shape, this);
	}

	@Override
	public void update(GameContainer container, int time){
		
	}

	@Override
	public void render(Graphics g){
		if(MainGame.debug()){
			mask.render(g);
		}
	}

	public CollisionMask getCollisionMask() {
		return mask;
	}

	public void setCollisionMask(CollisionMask mask) {
		this.mask = mask;
	}
	
	public float getSpeed() {
		return speed;
	}

	public void setSpeed(float speed) {
		this.speed = speed;
	}

	public float getWidth() {
		return width;
	}

	public void setWidth(float width) {
		this.width = width;
	}

	public float getHeight() {
		return height;
	}

	public void setHeight(float height) {
		this.height = height;
	}

	public boolean isStationary() {
		return stationary;
	}

	public void setStationary(boolean stationary) {
		this.stationary = stationary;
	}

	public float getPosY() {
		return posY;
	}

	public void setPosY(float posY) {
		this.posY = posY;
	}

	public float getPosX() {
		return posX;
	}

	public void setPosX(float posX) {
		this.posX = posX;
	}
	
	public float getCenterX() {
        return getPosX() + (32 / 2);
    }

    public float getCenterY() {
        return getPosY() + (32 / 2);
    }

	
	public void setPosition(float x, float y){
		this.posX = x;
		this.posY = y;
	}

	public boolean isCollidable() {
		return collidable;
	}

	public void setCollidable(boolean collidable) {
		this.collidable = collidable;
	}
	
	// public abstract void onCollision(AbstractEntity other);

}
